#pragma once

#include <stdint.h>

#include "topdbs_cross_platform.hpp"

namespace topdbs
{
    class topdbs_snowflake 
    {
    public:
        static uint64_t generator_id(uint32_t datacenter_workid);
        static uint64_t generator_id();
    private:
        static pid_t gettid( void );
        static uint64_t get_curr_ms();
        static uint64_t wait_next_ms(uint64_t lastStamp);
        static int atomic_incr(int id);

        topdbs_snowflake() = default;
        ~topdbs_snowflake() = default;
        topdbs_snowflake(const topdbs_snowflake&) = delete;
        topdbs_snowflake& operator=(const topdbs_snowflake&) = delete;
    }; 	
}
